<template>
  <div id="app">
    <h2>测试题</h2>
    <subject :list="list"></subject>
    <div>
      <flag :list="list"></flag>
    </div>
  </div>
</template>

<script setup>
import Subject from './components/SubjectItem.vue'
import Flag from './components/FlagItem.vue'
import { ref, onBeforeMount } from 'vue'
// const list = ref([
// 	{ a: 5, b: 3, daan: 10, done: '回答错误' },
// 	{ a: 7, b: 6, daan: 13, done: '回答正确' }
// ])
const list = ref([])
onBeforeMount(() => {
	// 初始化
	for(let i = 0; i < 5; i ++) {
		list.value.push({
			a: Math.floor(Math.random() * 10),
			b: Math.floor(Math.random() * 10),
			daan: 0, // 用户输入的答案
			done: '未完成'
		})
	}
})
</script>

<style scoped>
body {
  background-color: #eee;
}

#app {
  background-color: #fff;
  width: 500px;
  margin: 50px auto;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
  padding: 2em;
}
</style>